.class final Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;
.super Landroid/os/Handler;
.source "MraidEventBus.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;",
        ":",
        "Lcom/burstly/lib/component/networkcomponent/burstly/html/IDestroyableActivityLifecycleAware;",
        ">",
        "Landroid/os/Handler;"
    }
.end annotation


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private volatile mCleanedUp:Z

.field private final mEventsCache:Landroid/util/SparseArray;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/SparseArray",
            "<",
            "Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;",
            ">;"
        }
    .end annotation
.end field

.field private final mMraidView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "TT;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 36
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->LOG:Lcom/burstly/lib/util/LoggerExt;

    .line 41
    const-class v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->TAG:Ljava/lang/String;

    return-void
.end method

.method constructor <init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;)V"
        }
    .end annotation

    .prologue
    .line 64
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    .local p1, mraidView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;,"TT;"
    invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;

    move-result-object v0

    invoke-direct {p0, p1, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;-><init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;Landroid/os/Looper;)V

    .line 65
    return-void
.end method

.method constructor <init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;Landroid/os/Looper;)V
    .locals 1
    .parameter
    .parameter "looper"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;",
            "Landroid/os/Looper;",
            ")V"
        }
    .end annotation

    .prologue
    .line 73
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    .local p1, mraidView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;,"TT;"
    invoke-direct {p0, p2}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    .line 51
    new-instance v0, Landroid/util/SparseArray;

    invoke-direct {v0}, Landroid/util/SparseArray;-><init>()V

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    .line 74
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mMraidView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;

    .line 75
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->registerEvents()V

    .line 76
    return-void
.end method

.method private registerEvents()V
    .locals 3

    .prologue
    .line 82
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x0

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/ReadyEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/ReadyEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 83
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x1

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/OpenEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/OpenEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 84
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x2

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/CloseEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/CloseEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 85
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x3

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/ExpandEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/ExpandEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 86
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x4

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/VisibilityChangedEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/VisibilityChangedEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 87
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x5

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/WindowEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/WindowEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 88
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x6

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/PageLoadStartedEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/PageLoadStartedEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 89
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/4 v1, 0x7

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/SizePositionEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/SizePositionEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 90
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/16 v1, 0x8

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddCalendarEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 91
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/16 v1, 0x9

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 92
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/16 v1, 0xa

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/ResizeEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/ResizeEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 93
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/16 v1, 0xb

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/PlayVideoEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/PlayVideoEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 94
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    const/16 v1, 0xc

    new-instance v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/OrientationRequestedEvent;

    invoke-direct {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/OrientationRequestedEvent;-><init>()V

    invoke-virtual {v0, v1, v2}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 95
    return-void
.end method


# virtual methods
.method destroy()V
    .locals 3

    .prologue
    .line 122
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    const/4 v2, 0x1

    iput-boolean v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mCleanedUp:Z

    .line 123
    const/4 v0, 0x0

    .local v0, i:I
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    invoke-virtual {v2}, Landroid/util/SparseArray;->size()I

    move-result v1

    .local v1, len:I
    :goto_0
    if-ge v0, v1, :cond_0

    .line 124
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    invoke-virtual {v2, v0}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;

    invoke-virtual {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;->cleanUp()V

    .line 123
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 126
    :cond_0
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    invoke-virtual {v2}, Landroid/util/SparseArray;->clear()V

    .line 127
    return-void
.end method

.method public handleMessage(Landroid/os/Message;)V
    .locals 8
    .parameter "msg"

    .prologue
    .line 131
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    invoke-super {p0, p1}, Landroid/os/Handler;->handleMessage(Landroid/os/Message;)V

    .line 132
    iget-boolean v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mCleanedUp:Z

    if-eqz v2, :cond_0

    .line 146
    :goto_0
    return-void

    .line 135
    :cond_0
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mEventsCache:Landroid/util/SparseArray;

    iget v3, p1, Landroid/os/Message;->what:I

    invoke-virtual {v2, v3}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;

    .line 137
    .local v0, event:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;
    if-eqz v0, :cond_1

    :try_start_0
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mMraidView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;

    invoke-virtual {v2}, Lcom/burstly/lib/util/UiSafeWebView;->wasDestroyed()Z

    move-result v2

    if-nez v2, :cond_1

    .line 138
    iget-object v3, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mMraidView:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;

    iget-object v2, p1, Landroid/os/Message;->obj:Ljava/lang/Object;

    check-cast v2, [Ljava/lang/Object;

    check-cast v2, [Ljava/lang/Object;

    invoke-virtual {v0, v3, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEvent;->fireEvent(Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidView;[Ljava/lang/Object;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 143
    :catch_0
    move-exception v1

    .line 144
    .local v1, exception:Ljava/lang/Exception;
    sget-object v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v3, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->TAG:Ljava/lang/String;

    invoke-virtual {v2, v3, v1}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0

    .line 140
    .end local v1           #exception:Ljava/lang/Exception;
    :cond_1
    :try_start_1
    sget-object v2, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v3, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->TAG:Ljava/lang/String;

    const-string v4, "Event with {0} is not registered"

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/Object;

    const/4 v6, 0x0

    iget v7, p1, Landroid/os/Message;->what:I

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v7

    aput-object v7, v5, v6

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0
.end method

.method sendEvent(I)V
    .locals 1
    .parameter "eventId"

    .prologue
    .line 115
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->sendEvent(I[Ljava/lang/Object;)V

    .line 116
    return-void
.end method

.method sendEvent(I[Ljava/lang/Object;)V
    .locals 1
    .parameter "eventId"
    .parameter "args"

    .prologue
    .line 104
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;,"Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus<TT;>;"
    iget-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->mCleanedUp:Z

    if-nez v0, :cond_0

    .line 105
    invoke-virtual {p0, p1, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/MraidEventBus;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    .line 107
    :cond_0
    return-void
.end method
